Add text localization capabilities to pagination component - #1391
Merged
Conversation
🦋 Changeset detectedLatest commit: 05818ca The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🟢 No design token changes found |
There was a problem hiding this comment.
Pull request overview
Adds localization support to @primer/react-brand’s Pagination component by making the visible Previous/Next control text configurable via a new labels prop (resolving #1249), and updates surrounding documentation and test coverage.
Changes:
- Added
labels?: {prev?: string; next?: string}toPaginationand threaded labels into item rendering. - Added/updated Storybook feature story + Playwright visual snapshot to cover custom labels.
- Added unit tests, docs, and a changeset entry documenting the new API.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Pagination/Pagination.tsx | Adds labels prop and uses it to render customizable prev/next visible text. |
| packages/react/src/Pagination/Pagination.test.tsx | Adds unit tests for custom labels and default fallback behavior. |
| packages/react/src/Pagination/Pagination.features.stories.tsx | Adds Storybook feature story demonstrating localized labels. |
| packages/react/src/Pagination/Pagination.visual.spec.ts | Adds visual regression coverage for the custom labels story. |
| apps/next-docs/content/components/Pagination/index.mdx | Documents the new labels prop and provides a live example. |
| .changeset/pagination-labels-prop.md | Announces the new labels prop in release notes. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 4
- Review effort level: Low
Contributor
🟢 Bundle size report
|
Contributor
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
Contributor
🟢 Unit test coverage changes foundUnit test coverage has been updated through this PR. Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased
|
Merged
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #1249
Adds customizable prev/next text labels to the Pagination component. Previously they were hard-coded.
The Pagination component doesn't currently use the compound component API pattern, so adding a named child here felt like an overreach. It's currently modelled after its product counterpart component, where it's an entirely prop-based API.
🔗 Preview
List of notable changes:
labelprop which accepts a strongly typed objectWhat should reviewers focus on?
labelsprop, any better alternatives?Steps to test:
Supporting resources (related issues, external links, etc):
Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots: